package io.renren.modules.reception.init;

import io.renren.modules.store.entity.TTableThemeEntity;
import io.renren.modules.store.service.TTableThemeService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;
import java.util.List;

/**
 * 功能说明：
 * <p>
 * Original @Author: steakliu-刘牌, 2022-12-03  21:40
 * <p>
 * Copyright (C)2020-2022  steakliu All rights reserved.
 */
@Component
@Slf4j
public class TableThemeInit implements ApplicationRunner {
    @Resource
    private TTableThemeService tTableThemeService;

    @Override
    public void run(ApplicationArguments args) throws Exception {
        log.info("==========租户餐台配置初始化=======");
        List<TTableThemeEntity> list = tTableThemeService.list();
        list.forEach(item -> {
            log.info("租户餐台配置=======>商户id：{},配置详情：{}",item.getSellerId(), item);
            TableThemeCache.put(item.getSellerId(), item);
        });
    }
}
